<?php

namespace api\modules\user\controllers;

use api\modules\user\models\FollowForm;
use Yii;
use api\components\Controller;

/**
 * 用户粉丝
 */
class FansController extends Controller {

    public $modelClass = 'api\modules\user\models\FansSearch';

    /**
     * {@inheritdoc}
     */
    public function actions() {
        return [
            'view' => [
                'class' => 'yii\rest\ViewAction',
                'modelClass' => $this->modelClass,
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    protected function rules() {
        return [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            'index' => ['GET'],
            'remark' => ['POST'],
        ];
    }

    /**
     * 粉丝列表
     * @inheritdoc
     */
    public function actionIndex() {
        /* @var $modelClass \api\modules\user\models\FansSearch */
        $modelClass = new $this->modelClass;
        return $modelClass->search();
    }

    /**
     * 粉丝列表
     * @inheritdoc
     */
    public function actionIndexuser() {
        /* @var $modelClass \api\modules\user\models\FansSearch */
        $modelClass = new $this->modelClass;
        return $modelClass->searchForUser(Yii::$app->request->getQueryParams());
    }

}
